package com.huowenjie.web;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestHy {

    @RequestMapping("test1/{name}")
    @HystrixCommand(fallbackMethod = "testBack")
    public String test1(@PathVariable("name")  String name, Integer tt){

        if(name.equals("1")){
            throw new RuntimeException("出错了");
        }

        return name;
    }

    public String testBack(String user,Integer tt){
        return "服务出错了";
    }

}
